﻿using System;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
using System.Collections.Generic;

namespace Agenda_Project.Models
{
    public class DateTimePeriod
    {
        [Display(AutoGenerateField = false)]
        public string BeginDate { get; set; }

        [Display(AutoGenerateField = false)]
        public string BeginTime { get; set; }

        [Display(AutoGenerateField = false)]
        public string EndDate { get; set; }

        [Display(AutoGenerateField = false)]
        public string EndTime { get; set; }
    }

    public interface BaseModel
    {
        string Code { get; set; }
        string Name { get; set; }
        string NameTH { get; set; }
        bool Active { get; set; }
        long CreateByID { get; set; }
        string CreateDate { get; set; }
        string CreateTime { get; set; }
    }
    
    public abstract class SystemModel : BaseModel
    {
        [Display(AutoGenerateField = false, Name = "ID", Order = 1)]
        public byte ID { get; set; }

        [Required]
        [Display(Name = "Code", Order = 2)]
        public string Code { get; set; }

        [Display(Name = "Name", Order = 3)]
        public string Name { get; set; }

        [Display(Name = "Name (Th)", Order = 4)]
        public string NameTH { get; set; }

        [Display(AutoGenerateField = false)]
        public bool Active { get; set; }

        [Display(AutoGenerateField = false)]
        public long CreateByID { get; set; }

        [Display(AutoGenerateField = false)]
        public string CreateDate { get; set; }

        [Display(AutoGenerateField = false)]
        public string CreateTime { get; set; }
    }

    public abstract class MasterModel : BaseModel
    {
        [Display(AutoGenerateField = false, Name = "ID", Order = 1)]
        public long ID { get; set; }

        [Required]
        [Display(Name = "Code", Order = 2)]
        public string Code { get; set; }

        [Display(Name = "Name", Order = 3)]
        public string Name { get; set; }

        [Display(Name = "Name (Th)", Order = 4)]
        public string NameTH { get; set; }

        [Display(AutoGenerateField = false)]
        public bool Active { get; set; }

        [Display(AutoGenerateField = false)]
        public long CreateByID { get; set; }

        [Display(AutoGenerateField = false)]
        public string CreateDate { get; set; }

        [Display(AutoGenerateField = false)]
        public string CreateTime { get; set; }
    }

    public partial class CommitteeRole : SystemModel
    {
        [Display(AutoGenerateField = false)]
        public virtual ICollection<CommitteeMember> CommitteeMembers { get; set; }

        [Display(AutoGenerateField = false)]
        public virtual ICollection<MeetingMember> MeetingMembers { get; set; }

        public CommitteeRole()
        {
            this.CommitteeMembers = new HashSet<CommitteeMember>();
            this.MeetingMembers = new HashSet<MeetingMember>();
        }
    }

    public partial class MeetingType : SystemModel
    {
        [Display(AutoGenerateField = false)]
        public virtual ICollection<Meeting> Meetings { get; set; }

        public MeetingType()
        {
            this.Meetings = new HashSet<Meeting>();
        }
    }

    public partial class OwnerType : SystemModel
    {
        [Display(AutoGenerateField = false)]
        public virtual ICollection<MeetingAgenda> MeetingAgendas { get; set; }

        public OwnerType()
        {
            this.MeetingAgendas = new HashSet<MeetingAgenda>();
        }
    }

    public partial class TopicType : SystemModel {
        [Display(AutoGenerateField = false)]
        public virtual ICollection<MeetingAgendaTopic> MeetingAgendaTopics { get; set; }

        public TopicType()
        {
            this.MeetingAgendaTopics = new HashSet<MeetingAgendaTopic>();
        }
    }

    public partial class VoteType : SystemModel {
        [Display(AutoGenerateField = false)]
        public virtual ICollection<MeetingMemberVote> MeetingMemberVotes { get; set; }

        public VoteType()
        {
            this.MeetingMemberVotes = new HashSet<MeetingMemberVote>();
        }
    }

    public partial class Person : MasterModel
    {
        [Display(Name = "Title", Order = 5)]
        public string Title { get; set; }

        [Display(Name = "Surname", Order = 6)]
        public string Surname { get; set; }

        [Display(Name = "Surname (Th)", Order = 7)]
        public string SurnameTH { get; set; }

        [Display(Name = "Primary E-mail", Order = 8)]
        [DataType(DataType.EmailAddress)]
        public string PrimaryEmail { get; set; }

        [Display(Name = "Secondary E-mail", Order = 9)]
        [DataType(DataType.EmailAddress)]
        public string SecondaryEmail { get; set; }

        [Display(AutoGenerateField = false)]
        public virtual ICollection<User> Users { get; set; }

        public Person()
        {
            this.Users = new HashSet<User>();
        }
    }

    public partial class User : MasterModel
    {
        [Display(AutoGenerateField = false)]
        public long PersonID { get; set; }

        [Display(Name = "Person", Order = 5)]
        public virtual Person Person { get; set; }

        [Display(Name = "Password", Order = 6)]
        [DataType(DataType.Password)]
        public string Password { get; set; }

        [Display(Name = "Period", Order = 7)]
        public DateTimePeriod Period { get; set; }

        [Display(AutoGenerateField = false)]
        public virtual ICollection<Committee> Committees { get; set; }
        [Display(AutoGenerateField = false)]
        public virtual ICollection<Committee> Committees1 { get; set; }
        [Display(AutoGenerateField = false)]
        public virtual ICollection<CommitteeMember> CommitteeMembers { get; set; }
        [Display(AutoGenerateField = false)]
        public virtual ICollection<CommitteeMember> CommitteeMembers1 { get; set; }
        [Display(AutoGenerateField = false)]
        public virtual ICollection<CommitteeMember> CommitteeMembers2 { get; set; }
        [Display(AutoGenerateField = false)]
        public virtual ICollection<Meeting> Meetings { get; set; }
        [Display(AutoGenerateField = false)]
        public virtual ICollection<Meeting> Meetings1 { get; set; }
        [Display(AutoGenerateField = false)]
        public virtual ICollection<MeetingAgenda> MeetingAgendas { get; set; }
        [Display(AutoGenerateField = false)]
        public virtual ICollection<MeetingAgenda> MeetingAgendas1 { get; set; }
        [Display(AutoGenerateField = false)]
        public virtual ICollection<MeetingAgenda> MeetingAgendas2 { get; set; }
        [Display(AutoGenerateField = false)]
        public virtual ICollection<MeetingAgendaTopic> MeetingAgendaTopics { get; set; }
        [Display(AutoGenerateField = false)]
        public virtual ICollection<MeetingAgendaTopic> MeetingAgendaTopics1 { get; set; }
        [Display(AutoGenerateField = false)]
        public virtual ICollection<MeetingMember> MeetingMembers { get; set; }
        [Display(AutoGenerateField = false)]
        public virtual ICollection<MeetingMember> MeetingMembers1 { get; set; }
        [Display(AutoGenerateField = false)]
        public virtual ICollection<MeetingMember> MeetingMembers2 { get; set; }
        [Display(AutoGenerateField = false)]
        public virtual ICollection<MeetingMemberVote> MeetingMemberVotes { get; set; }
        [Display(AutoGenerateField = false)]
        public virtual ICollection<MeetingMemberVote> MeetingMemberVotes1 { get; set; }
        [Display(AutoGenerateField = false)]
        public virtual ICollection<MeetingReport> MeetingReports { get; set; }
        [Display(AutoGenerateField = false)]
        public virtual ICollection<MeetingReport> MeetingReports1 { get; set; }
        [Display(AutoGenerateField = false)]
        public virtual ICollection<MeetingReport> MeetingReports2 { get; set; }
        [Display(AutoGenerateField = false)]
        public virtual ICollection<MeetingReport> MeetingReports3 { get; set; }

        public User()
        {
            this.Committees = new HashSet<Committee>();
            this.Committees1 = new HashSet<Committee>();
            this.CommitteeMembers = new HashSet<CommitteeMember>();
            this.CommitteeMembers1 = new HashSet<CommitteeMember>();
            this.CommitteeMembers2 = new HashSet<CommitteeMember>();
            this.Meetings = new HashSet<Meeting>();
            this.Meetings1 = new HashSet<Meeting>();
            this.MeetingAgendas = new HashSet<MeetingAgenda>();
            this.MeetingAgendas1 = new HashSet<MeetingAgenda>();
            this.MeetingAgendas2 = new HashSet<MeetingAgenda>();
            this.MeetingAgendaTopics = new HashSet<MeetingAgendaTopic>();
            this.MeetingAgendaTopics1 = new HashSet<MeetingAgendaTopic>();
            this.MeetingMembers = new HashSet<MeetingMember>();
            this.MeetingMembers1 = new HashSet<MeetingMember>();
            this.MeetingMembers2 = new HashSet<MeetingMember>();
            this.MeetingMemberVotes = new HashSet<MeetingMemberVote>();
            this.MeetingMemberVotes1 = new HashSet<MeetingMemberVote>();
            this.MeetingReports = new HashSet<MeetingReport>();
            this.MeetingReports1 = new HashSet<MeetingReport>();
            this.MeetingReports2 = new HashSet<MeetingReport>();
            this.MeetingReports3 = new HashSet<MeetingReport>();
            this.Period = new DateTimePeriod();
        }
    }
}